from django.core.mail import send_mail

from celery_tasks.main import app

@app.task(name="send_verify_mail")
def send_verify_mail(subject, html_message, recipient_list):
    print('==============================================')
    subject = subject  # 标题
    message = ""  # 内容
    from_email = 'shi_2001@126.com'  # 发送方邮箱地址
    recipient_list = recipient_list  # 接收方邮箱地址 列表
    try:
        print("正在发送------>")
        send_mail(subject, message, from_email, recipient_list, html_message=html_message)
    except Exception as e:
        print("发送邮件失败", e)